#pragma once
#include "Common.hpp"

class CentralCache
{
public:
    static CentralCache* GetInstance()
    {
        return &_inst;
    }
    //将一批内存块给线程内存池
    size_t FetchRangeObj(size_t size, void* start, void* end, size_t batchNum);
    // 获取一个非空的Span   
    Span* CentralCache::GetOneSpan(SpanList& list, size_t size);
    //回收一批内存块
    void ReleaseListToCentralCache(void* start, size_t size);
private:
    SpanList _cc_freelists[NFREELIST];
    
    //单例模式
    static CentralCache _inst;

    CentralCache(){}
    CentralCache(const CentralCache&) = delete;
    CentralCache& operator=(const CentralCache&) = delete;
};